import request from '@/utils/request'

/*
export function getList() {
  return request({
    url: '/gathering/gathering',
    method: 'get'
  })
}

export function search(page, size, searchData) {
  return request({
    url: '/gathering/gathering/search/{page}/{size}',
    method: 'post',
    data: searchData
  })
}
*/
const group_name = 'gathering'
const api_name = 'gathering'

export default {
  getList() {
    return request({
      url: `/${group_name}/${api_name}`,
      method: 'get'
    })
  },
  search(page, size, searchData) {
    return request({
      url: `/${group_name}/${api_name}/search/${page}/${size}`,
      method: 'post',
      data: searchData
    })
  },
  save(pojo) {
    return request({
      url: `/${group_name}/${api_name}`,
      method: 'post',
      data: pojo
    })
  },
  findById(id) {
    return request({
      url: `/${group_name}/${api_name}/${id}`,
      method: 'get'
    })
  },
  update(id, pojo) {
    if (id === 0) {
      return this.save(pojo)
    }
    return request({
      url: `/${group_name}/${api_name}/${id}`,
      method: 'put',
      data: pojo
    })
  },
  delete(id) {
    return request({
      url: `/${group_name}/${api_name}/${id}`,
      method: 'delete'
    })
  }
}
